package org.rudenko.horo;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;


public class DbHelper extends SQLiteOpenHelper {
		public static int DB_VERSION = 1;
		public static String TABLE_NAME = "horoscope.db";
		public static String TABLE_CACHE = "horo_cache";
		public static String TABLE_SAVE = "horo_save";
		public static String PARAMS = "params";	
		public static String HORO = "horo";
		public static String CREATE_CACHE_TABLE = "CREATE TABLE "+TABLE_CACHE+" ("+PARAMS+" TEXT, "+HORO+" TEXT)";
		public static String CREATE_SAVE_TABLE = "CREATE TABLE "+TABLE_SAVE+" ("+PARAMS+" TEXT, "+HORO+" TEXT)";
		 
		public DbHelper(Context context) {
			super(context, TABLE_NAME, null, DB_VERSION);
		}

		@Override
		public void onCreate(SQLiteDatabase db) {
			db.execSQL(CREATE_CACHE_TABLE);
			db.execSQL(CREATE_SAVE_TABLE);
		}

		@Override
		public void onUpgrade(SQLiteDatabase db, int arg1, int arg2) {
		    db.execSQL("DROP TABLE IF EXISTS ".concat(TABLE_NAME));
		    onCreate(db);
			
		}
}


